package com.zj.leetcode.easy;

/**
 * @program: algorithm
 * @description:
 * @author: Zhang Bo
 * @create: 2022-01-11 16:52
 **/
public class StudentAttendanceRecordI {
    public static void main(String[] args) {
//        String s = "PPALLP";
        String s = "AA";
//        String s = "PPALLL";
        Solution solution = new StudentAttendanceRecordI().new Solution();
        System.out.println(solution.checkRecord(s));
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public boolean checkRecord(String s) {
            if(s.contains("LLL") || (s.replace("A", "").length() + 2) <= s.length()){
                return false;
            }
            return true;
        }

        /**
         * 少于2天 是只有一天，那 indexOf == lastIndexOf 说明只有一个A
         * @param s
         * @return
         */
        public boolean checkRecord02(String s) {
            return s.indexOf("A") == s.lastIndexOf("A") && !s.contains("LLL");
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}
